package com.mate.cloud.admin.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 资源控制器
 * @author:         MI
 * @email:          448341911@qq.com
 * @createTime:     2025/2/3 11:57
 * @updateUser:     MI
 * @updateTime:     2025/2/3 11:57
 * @updateRemark:   修改内容
 * @version:        v1.0
 */
@RestController
public class ResourceController {

    @GetMapping("/messages1")
    public String getMessages1() {
        return " hello Message 1";
    }

    @GetMapping("/messages2")
    @PreAuthorize("hasAuthority('SCOPE_profile')")
    public String getMessages2() {
        return " hello Message 2";
    }

    @GetMapping("/messages3")
    @PreAuthorize("hasAuthority('SCOPE_Message')")
    public String getMessages3() {
        return " hello Message 3";
    }

    @GetMapping("/messages4")
    @PreAuthorize("hasAuthority('SCOPE_USER')")
    public String getMessages4() {
        return " hello Message 4";
    }
    @GetMapping("/messages5")
    @PreAuthorize("hasRole('ROLE_ADMIN')")
    public String getMessages5() {
        return " hello Message 5";
    }
}
